/*
 * schmitt.h
 *
 *  Created: 20250718
 *  Author: Hecate
 */
#ifndef CODE_SCHMITT_H_
#define CODE_SCHMITT_H_

#include <stdint.h>

// 施密特触发器对象句柄
typedef struct SchmittTrigger SchmittTrigger;

// 初始化触发器阈值和输出状态
SchmittTrigger *schmittInit(float upperThresh, float lowerThresh, uint8_t initState);

// 输入新采样值并更新输出
void schmittProcess(SchmittTrigger *obj, float inputValue);

// 重新设置上下阈值
void schmittSetThresholds(SchmittTrigger *obj, float upperThresh, float lowerThresh);

// 读取当前输出状态
uint8_t schmittGetOutputState(const SchmittTrigger *obj);

#endif /* CODE_SCHMITT_H_ */
